package cn.hdustea.shopNavigation.entity

import android.os.Parcel
import android.os.Parcelable

/**
 * <pre>
 *     author : HuQiang
 *     time   : 2020/09/25
 *     desc   :
 *     version: 1.0
 * </pre>
 */
data class MarketSelect(
        val name: String,
        val markets: MutableList<Market>
)

data class Market(
        val name: String?,
        val distance: Float
) : Parcelable {
    constructor(parcel: Parcel) : this(
            parcel.readString(),
            parcel.readFloat()
    )

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(name)
        parcel.writeFloat(distance)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<Market> {
        override fun createFromParcel(parcel: Parcel): Market {
            return Market(parcel)
        }

        override fun newArray(size: Int): Array<Market?> {
            return arrayOfNulls(size)
        }
    }
}